package com.ymatou.iapi.productprice.testcase;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;

import org.json.JSONException;
import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.productprice.parameter.ProductAllPriceBean;
import com.ymatou.iapi.productprice.parameter.ProductPriceBean;
import com.ymatou.iapi.productprice.service.GetNextActivityPriceByProdIdsCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.ProductPriceCallService;
import com.ymttest.database.mongo.YmtMongoDriverFactroy;
import com.ymttest.database.mongo.jproduct.ActivityProductsWapper;
import com.ymttest.database.mongo.jproduct.ProductTimeStampWapper;
import com.ymttest.database.mongo.jproduct.ProductsWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.MapUtil;


public class Ts_GetNextActivityPriceByProdIds {
	// 3332634 level 0 registerTime 2015-05-26 14:20:04
	private static int newBuyerId = ProductPriceCallService.getNewCustomer();

	// 20238699 level 6 registerTime 2016-04-22 10:19:05
	private static int oldBuyerId = ProductPriceCallService.getOldCustomer();

	
	private static Integer sellerId = Integer.valueOf(EnvSetup.getData("productpriceSellerId"));
	
	
	private static GetNextActivityPriceByProdIdsCall getNextActivityPriceByProdIdsCall = new GetNextActivityPriceByProdIdsCall();

	private static ActivityProductsWapper activityProductsWapper = new ActivityProductsWapper();
	
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("下一场活动商品的价格查询");
	}

	@Before
	public void caseUp() {

	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getNextActivityPriceByProdIdsCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	public static void checkRetAsNoPrice(JSONObject ret,String desc) throws JSONException{
		Logger.verifyEquals(0, ret.getJSONObject("Data").getJSONArray("ProductPriceList").length(), desc);
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetNextActivityPriceByProdIds_001() {
		Logger.start(true, "非交易隔离的会员活动");
		try {
			String productId = ProductPriceCallService.getProductIdWithAllPrice();
			
			ProductAllPriceBean productAllPriceBean = ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,
								productId,MapUtil.hashMap("ActivityTemplateId", ProductPriceCallService.tpl_Nisolation_Npartcatalog_Nnewbuyer_Member));
			
			
			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
			new ActivityProductsWapper().update(productAllPriceBean.getProductId(), MapUtil.hashMap("part",false,"nbuyer",false,"isolation",false));
			}
			
					
			int prodInActivityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());

			//新客 会员价
			ProductPriceBean priceIncludeActivity_NewCust = ProductPriceCallService.getProductPriceBeanByUserLevel(productAllPriceBean,true,false);
			//老客 会员价
			ProductPriceBean priceIncludeActivity_OleCust = ProductPriceCallService.getProductPriceBeanByUserLevel(productAllPriceBean,false,false);
			
			
			//==================================================================================
			//会员政策1， 会员等级3以上才能享受活动价
			ProductPriceCallService.updateActivityMemberPolicy(prodInActivityId, 1, "3,4,5,6");
			
			//IsTradeIsolation= true
			//0级会员 新客 无返回
			JSONObject ret1_1 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret1_1, "不满足会员条件，不返回数据");
			
			//6级会员  老客 会员活动价
			JSONObject ret1_2 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_2, Arrays.asList(priceIncludeActivity_OleCust));
			
			//IsTradeIsolation= false
			//0级会员 新客 无返回
			JSONObject ret1_3 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret1_3, "不满足会员条件，不返回数据");
			
			//6级会员  老客 会员活动价
			JSONObject ret1_4 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_4, Arrays.asList(priceIncludeActivity_OleCust));
			
			
			//==================================================================================
			//会员政策2，会员注册时间在2017-01-02 到 2017-03-23 才能享受活动价
			ProductPriceCallService.updateActivityMemberPolicy(prodInActivityId, 2, "2015-01-02 00:00:00,2016-03-23 23:59:59");
			
			//IsTradeIsolation= true
			//新客 注册时间2015-05-26 14:20:04 会员活动价
			JSONObject ret2_1 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId, true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret2_1, Arrays.asList(priceIncludeActivity_NewCust));
			
			//老客 注册时间2016-04-22 10:19:05 不返回数据
			JSONObject ret2_2 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId, true,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret2_2, "不满足会员条件，不返回数据");
			
			//IsTradeIsolation= false
			//新客 注册时间2015-05-26 14:20:04 会员活动价
			JSONObject ret2_3 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId, false,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret2_3, Arrays.asList(priceIncludeActivity_NewCust));
			
			//老客 注册时间2016-04-22 10:19:05 不返回数据
			JSONObject ret2_4 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId, false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret2_4, "不满足会员条件，不返回数据");
			
		
			//==================================================================================
			//会员政策3， 会员标签满足才能享受活动价  标签值 3 
			ProductPriceCallService.updateActivityMemberPolicy(prodInActivityId,3, "3");
			
			//IsTradeIsolation= true
			//新客 标签3  会员活动价
			JSONObject ret3_1 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId, true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret3_1, Arrays.asList(priceIncludeActivity_NewCust));
			
			//老客 没标签 不返回数据
			JSONObject ret3_2 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId, true,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret3_2, "不满足会员条件，不返回数据");
			
			//IsTradeIsolation= false
			//新客 标签3  会员活动价
			JSONObject ret3_3 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId, false,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret3_3, Arrays.asList(priceIncludeActivity_NewCust));
			
			//老客 没标签 不返回数据
			JSONObject ret3_4 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId, false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret3_4, "不满足会员条件，不返回数据");
			
			
			//==============================================================================================
			//会员政策3， 会员标签满足才能享受活动价  标签值 4
			ProductPriceCallService.updateActivityMemberPolicy(prodInActivityId,3, "4");
			
			//新客  标签3  普通价
			JSONObject ret4 =getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret4, "不满足会员条件，不返回数据");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetNextActivityPriceByProdIds_002() {
		Logger.start(true, "交易隔离的会员活动");
		try {
			String productId = ProductPriceCallService.getProductIdWithAllPrice();
			
			ProductAllPriceBean productAllPriceBean = ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,
								productId,MapUtil.hashMap("ActivityTemplateId", ProductPriceCallService.tpl_isolation_Npartcatalog_Nnewbuyer_Member));
				
			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
				new ActivityProductsWapper().update(productAllPriceBean.getProductId(), MapUtil.hashMap("part",false,"nbuyer",false,"isolation",true));
				}
				
			
			
			int prodInActivityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());

			//新客 会员价
			ProductPriceBean priceIncludeActivity_NewCust = ProductPriceCallService.getProductPriceBeanByUserLevel(productAllPriceBean,true,false);
			//老客 会员价
			ProductPriceBean priceIncludeActivity_OleCust = ProductPriceCallService.getProductPriceBeanByUserLevel(productAllPriceBean,false,false);
			
			
			//==================================================================================
			//会员政策1， 会员等级3以上才能享受活动价
			ProductPriceCallService.updateActivityMemberPolicy(prodInActivityId, 1, "3,4,5,6");
			
			//IsTradeIsolation= true
			//0级会员 新客 无返回
			JSONObject ret1_1 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret1_1, "不满足会员条件，不返回数据");
			
			//6级会员  老客 会员活动价
			JSONObject ret1_2 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_2, Arrays.asList(priceIncludeActivity_OleCust));
			
			//IsTradeIsolation= false
			//0级会员 新客 无返回
			JSONObject ret1_3 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret1_3, "非交易隔离接口查交易隔离活动，不返回数据");
			
			//6级会员  老客 无返回
			JSONObject ret1_4 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret1_4, "非交易隔离接口查交易隔离活动，不返回数据");
			
			
			//==================================================================================
			//会员政策2，会员注册时间在2017-01-02 到 2017-03-23 才能享受活动价
			ProductPriceCallService.updateActivityMemberPolicy(prodInActivityId, 2, "2015-01-02 00:00:00,2016-03-23 23:59:59");
			
			//IsTradeIsolation= true
			//新客 注册时间2015-05-26 14:20:04 会员活动价
			JSONObject ret2_1 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId, true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret2_1, Arrays.asList(priceIncludeActivity_NewCust));
			
			//老客 注册时间2016-04-22 10:19:05 不返回数据
			JSONObject ret2_2 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId, true,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret2_2, "不满足会员条件，不返回数据");
			
			//IsTradeIsolation= false
			//0级会员 新客 无返回
			JSONObject ret2_3 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret2_3, "非交易隔离接口查交易隔离活动，不返回数据");
			
			//6级会员  老客 无返回
			JSONObject ret2_4 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret2_4, "非交易隔离接口查交易隔离活动，不返回数据");
			
		
			//==================================================================================
			//会员政策3， 会员标签满足才能享受活动价  标签值 3 
			ProductPriceCallService.updateActivityMemberPolicy(prodInActivityId,3, "3");
			
			//IsTradeIsolation= true
			//新客 标签3  会员活动价
			JSONObject ret3_1 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId, true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret3_1, Arrays.asList(priceIncludeActivity_NewCust));
			
			//老客 没标签 不返回数据
			JSONObject ret3_2 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId, true,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret3_2, "不满足会员条件，不返回数据");
			
			//IsTradeIsolation= false
			//0级会员 新客 无返回
			JSONObject ret3_3 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret3_3, "非交易隔离接口查交易隔离活动，不返回数据");
			
			//6级会员  老客 无返回
			JSONObject ret3_4 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret3_4, "非交易隔离接口查交易隔离活动，不返回数据");
			
			
			//==============================================================================================
			//会员政策3， 会员标签满足才能享受活动价  标签值 4
			ProductPriceCallService.updateActivityMemberPolicy(prodInActivityId,3, "4");
			
			//新客  标签3  普通价
			JSONObject ret4 =getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret4, "不满足会员条件，不返回数据");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetNextActivityPriceByProdIds_003() {
		Logger.start(true, "非交易隔离的新人活动");
		try {
			String productId = ProductPriceCallService.getProductIdWithAllPrice();
			
			ProductAllPriceBean productAllPriceBean = ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,
								productId,MapUtil.hashMap("ActivityTemplateId", ProductPriceCallService.tpl_Nisolation_partcatalog_newbuyer));
			
			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
				new ActivityProductsWapper().update(productAllPriceBean.getProductId(), MapUtil.hashMap("part",true,"nbuyer",true,"isolation",false,"mlimits",new ArrayList<>()));
			}
				
			
			int prodInActivityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());

			//新客 新客活动价
			ProductPriceBean priceIncludeActivity_NewCust = ProductPriceCallService.getProductPriceBeanByUserLevel(productAllPriceBean,true,false);
			
			//==================================================================================
			//IsTradeIsolation= true
			//新客 活动价 
			JSONObject ret1_1 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_1, Arrays.asList(priceIncludeActivity_NewCust));
			
			//老客 无返回
			JSONObject ret1_2 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret1_2, "老会员不享受活动价，不返回数据");
			
			//IsTradeIsolation= false
			//新客 活动价 
			JSONObject ret1_3 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_3, Arrays.asList(priceIncludeActivity_NewCust));
			
			//老客 无返回
			JSONObject ret1_4 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret1_4, "老会员不享受活动价，不返回数据");
			
			
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetNextActivityPriceByProdIds_004() {
		Logger.start(true, "交易隔离的新人活动");
		try {
			String productId = ProductPriceCallService.getProductIdWithAllPrice();
			
			ProductAllPriceBean productAllPriceBean = ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,
								productId,MapUtil.hashMap("ActivityTemplateId", ProductPriceCallService.tpl_isolation_partcatalog_newbuyer));
				
			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
				new ActivityProductsWapper().update(productAllPriceBean.getProductId(), MapUtil.hashMap("part",true,"nbuyer",true,"isolation",true,"mlimits",new ArrayList<>()));
			}
			
			int prodInActivityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());

			//新客 新客活动价
			ProductPriceBean priceIncludeActivity_NewCust = ProductPriceCallService.getProductPriceBeanByUserLevel(productAllPriceBean,true,false);
			
			//==================================================================================
			//IsTradeIsolation= true
			//新客 活动价 
			JSONObject ret1_1 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_1, Arrays.asList(priceIncludeActivity_NewCust));
			
			//老客 无返回
			JSONObject ret1_2 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret1_2, "老会员不享受活动价，不返回数据");
			
			//IsTradeIsolation= false
			//新客 活动价 
			JSONObject ret1_3 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret1_3, "非交易隔离接口查交易隔离活动，不返回数据");
			
			//老客 无返回
			JSONObject ret1_4 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret1_4, "老会员不享受活动价，不返回数据");
			
			
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetNextActivityPriceByProdIds_005() {
		Logger.start(true, "非交易隔离普通活动");
		try {
			String productId = ProductPriceCallService.getProductIdWithAllPrice();
			
			ProductAllPriceBean productAllPriceBean = ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,
								productId,MapUtil.hashMap("ActivityTemplateId", ProductPriceCallService.tpl_Nisolation_Npartcatalog_Nnewbuyer));
				
			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
				new ActivityProductsWapper().update(productAllPriceBean.getProductId(), MapUtil.hashMap("part",false,"nbuyer",false,"isolation",false,"mlimits",new ArrayList<>()));
			}
			
			
			int prodInActivityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());

			//新客 活动价
			ProductPriceBean priceIncludeActivity_NewCust = ProductPriceCallService.getProductPriceBeanByUserLevel(productAllPriceBean,true,false);
			//老客 活动价
			ProductPriceBean priceIncludeActivity_OleCust = ProductPriceCallService.getProductPriceBeanByUserLevel(productAllPriceBean,false,false);
			
			//==================================================================================
			//IsTradeIsolation= true
			//新客 活动价 
			JSONObject ret1_1 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_1, Arrays.asList(priceIncludeActivity_NewCust));
			
			//老客 活动价
			JSONObject ret1_2 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_2, Arrays.asList(priceIncludeActivity_OleCust));
			
			//IsTradeIsolation= false
			//新客 活动价 
			JSONObject ret1_3 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_3, Arrays.asList(priceIncludeActivity_NewCust));
			
			//老客 活动价
			JSONObject ret1_4 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_4, Arrays.asList(priceIncludeActivity_OleCust));
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetNextActivityPriceByProdIds_006() {
		Logger.start(true, "交易隔离普通活动");
		try {
			String productId = ProductPriceCallService.getProductIdWithAllPrice();
			
			ProductAllPriceBean productAllPriceBean = ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,
								productId,MapUtil.hashMap("ActivityTemplateId", ProductPriceCallService.tpl_isolation_Npartcatalog_Nnewbuyer));
				
			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
				new ActivityProductsWapper().update(productAllPriceBean.getProductId(), MapUtil.hashMap("part",false,"nbuyer",false,"isolation",true,"mlimits",new ArrayList<>()));
			}
			
			int prodInActivityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());

			//新客 活动价
			ProductPriceBean priceIncludeActivity_NewCust = ProductPriceCallService.getProductPriceBeanByUserLevel(productAllPriceBean,true,false);
			//老客 活动价
			ProductPriceBean priceIncludeActivity_OleCust = ProductPriceCallService.getProductPriceBeanByUserLevel(productAllPriceBean,false,false);
			
			//==================================================================================
			//IsTradeIsolation= true
			//新客 活动价 
			JSONObject ret1_1 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_1, Arrays.asList(priceIncludeActivity_NewCust));
			
			//老客 活动价
			JSONObject ret1_2 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_2, Arrays.asList(priceIncludeActivity_OleCust));
			
			//IsTradeIsolation= false
			//新客 活动价 
			JSONObject ret1_3 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret1_3, "非交易隔离接口查交易隔离活动，不返回数据");
			
			//老客 活动价
			JSONObject ret1_4 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(oldBuyerId,false,MapUtil.hashMap(productId, prodInActivityId));
			checkRetAsNoPrice(ret1_4, "非交易隔离接口查交易隔离活动，不返回数据");
			
			
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetNextActivityPriceByProdIds_007() {
		Logger.start(true, "测试缓存ExtraDeliveryType,ExtraDeliveryFee");
		try {
			String productId = ProductPriceCallService.getProductIdWithAllPrice();
			
			ProductAllPriceBean productAllPriceBean = ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,
								productId,MapUtil.hashMap("ActivityTemplateId", ProductPriceCallService.tpl_isolation_Npartcatalog_Nnewbuyer));
				
			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
				new ActivityProductsWapper().update(productAllPriceBean.getProductId(), MapUtil.hashMap("part",false,"nbuyer",false,"isolation",true,"mlimits",new ArrayList<>()));
			}
			
			int prodInActivityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());

			//新客 活动价
			ProductPriceBean priceIncludeActivity_NewCust = ProductPriceCallService.getProductPriceBeanByUserLevel(productAllPriceBean,true,false);
			JSONObject ret1 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1, Arrays.asList(priceIncludeActivity_NewCust));
			
			//修改ExtraDeliveryType,ExtraDeliveryFee ， 不修改时间戳
			new ProductsWapper().updateAll(MapUtil.hashMap("spid",productId), MapUtil.hashMap("mdeliv",2,"mflight",3.1));
			JSONObject ret1_1 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret1_1, Arrays.asList(priceIncludeActivity_NewCust));
			
			
			//修改时间戳
			new ProductTimeStampWapper().update(productId, MapUtil.hashMap("sut",new Date()));
			ProductPriceBean priceIncludeActivity_NewCust2 = ProductPriceCallService.getProductPriceBeanByUserLevel(productAllPriceBean,true,false);
			JSONObject ret2 = getNextActivityPriceByProdIdsCall.callAndGetReturnData(newBuyerId,true,MapUtil.hashMap(productId, prodInActivityId));
			ProductPriceCallService.checkPriceList(ret2, Arrays.asList(priceIncludeActivity_NewCust2));
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
}
